/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hu
 * Date: 2024-04-27
 * Time: 12:25
 */
import java.util.Scanner;
public class Test {
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int year = sc.nextInt();
        if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
            System.out.println("闰年");
        }
    }
    public static void main2(String[] args) {
        for (int n = 2; n <= 100; n++) {
            int i = 0;
            for ( i = 2; i <= n; i++) {
                if (n % i == 0) {
                    break;
                }

            }
            if (n == i) {
                System.out.println(i);
            }
        }
    }
    public static void main3(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入数字");
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++){
            if(i == j|| i + j == n - 1){
                System.out.print("*");
            }else{
                System.out.print(" ");
            }
        }
            System.out.println();
    }
}
    public static void main4(String[] args) {
        double sum = 0;
        for (int i = 1; i <= 100; i++) {
            if(i % 2 == 1){
                sum += 1.0 / i;
            }else if(i % 2 == 0){
                sum -= 1.0 / i;
            }
        }
        System.out.println(sum);
    }
    public static void main5(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入被除数");
        int a = sc.nextInt();
        System.out.println("请输入除数");
        int b = sc.nextInt();
        int ret = 0;
        /*if(a < b){
            int tmp = 0;
            tmp = a;
            a = b;
            b = tmp;
        }*/
        while(b != 0){

            ret = a % b;
            a = b;
            b = ret;
        }
        System.out.println(a);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入数字");
        int n = sc.nextInt();
        int count = 0;
        while(n != 0){
            if(n % 2 == 1){
                count++;
            }
            n /= 2;
        }
        System.out.println("二进制中1的个数为：" + count);
    }
}